home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / MPW Related / MPW Interfaces / CIncludes / Printing.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-17  |  9.6 KB  |  360 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Printing.h
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. */
  11.  
  12. #ifndef __PRINTING__
  13. #define __PRINTING__
  14.  
  15. #ifndef __QUICKDRAW__
  16. #include <Quickdraw.h>
  17. #endif
  18.  
  19. #ifndef __DIALOGS__
  20. #include <Dialogs.h>
  21. #endif
  22.  
  23.  
  24. enum {
  25.  
  26.  iPFMaxPgs = 128,
  27.  iPrPgFract = 120,                /*Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract*/
  28.  iPrPgFst = 1,                    /*Page range constants*/
  29.  iPrPgMax = 9999,
  30.  iPrRelease = 3,                /*Current version number of the code.*/
  31.  iPrSavPFil = -1,
  32.  iPrAbort = 0x0080,
  33.  iPrDevCtl = 7,                    /*The PrDevCtl Proc's ctl number*/
  34.  lPrReset = 0x00010000,            /*The PrDevCtl Proc's CParam for reset*/
  35.  lPrLineFeed = 0x00030000,
  36.  lPrLFStd = 0x0003FFFF,            /*The PrDevCtl Proc's CParam for std paper advance*/
  37.  lPrLFSixth = 0x0003FFFF,
  38.  lPrPageEnd = 0x00020000,        /*The PrDevCtl Proc's CParam for end page*/
  39.  lPrDocOpen = 0x00010000,
  40.  lPrPageOpen = 0x00040000,
  41.  lPrPageClose = 0x00020000,
  42.  lPrDocClose = 0x00050000,
  43.  iFMgrCtl = 8,                    /*The FMgr's Tail-hook Proc's ctl number*/
  44.  iMscCtl = 9,                    /*The FMgr's Tail-hook Proc's ctl number*/
  45.  iPvtCtl = 10                    /*The FMgr's Tail-hook Proc's ctl number*/
  46. };
  47. enum {
  48.  iMemFullErr = -108,
  49.  iIOAbort = -27,
  50.  pPrGlobals = 0x00000944,        /*The PrVars lo mem area:*/
  51.  bDraftLoop = 0,
  52.  bSpoolLoop = 1,
  53.  bUser1Loop = 2,
  54.  bUser2Loop = 3,
  55.  fNewRunBit = 2,
  56.  fHiResOK = 3,
  57.  fWeOpenedRF = 4,
  58.  
  59. /*Driver constants */
  60.  iPrBitsCtl = 4,
  61.  lScreenBits = 0,
  62.  lPaintBits = 1,
  63.  lHiScreenBits = 0x00000002,    /*The Bitmap Print Proc's Screen Bitmap param*/
  64.  lHiPaintBits = 0x00000003,        /*The Bitmap Print Proc's Paint [sq pix] param*/
  65.  iPrIOCtl = 5,
  66.  iPrEvtCtl = 6,                    /*The PrEvent Proc's ctl number*/
  67.  lPrEvtAll = 0x0002FFFD,        /*The PrEvent Proc's CParam for the entire screen*/
  68.  lPrEvtTop = 0x0001FFFD,        /*The PrEvent Proc's CParam for the top folder*/
  69.  
  70. #define sPrDrvr ".Print"
  71.  
  72.  iPrDrvrRef = -3
  73. };
  74. enum {
  75.  getRslDataOp = 4,
  76.  setRslOp = 5,
  77.  draftBitsOp = 6,
  78.  noDraftBitsOp = 7,
  79.  getRotnOp = 8,
  80.  NoSuchRsl = 1,
  81.  OpNotImpl = 2,                    /*the driver doesn't support this opcode*/
  82.  RgType1 = 1
  83. };
  84.  
  85. enum {feedCut,feedFanfold,feedMechCut,feedOther};
  86. typedef unsigned char TFeed;
  87.  
  88. enum {scanTB,scanBT,scanLR,scanRL};
  89. typedef unsigned char TScan;
  90.  
  91.  
  92. typedef Rect *TPRect;            /* A Rect Ptr */
  93. typedef pascal void (*PrIdleProcPtr)(void);
  94. typedef pascal void (*PItemProcPtr)(DialogPtr theDialog, short item);
  95.  
  96. struct TPrPort {
  97.  GrafPort gPort;                /*The Printer's graf port.*/
  98.  QDProcs gProcs;                /*..and its procs*/
  99.  long lGParam1;                    /*16 bytes for private parameter storage.*/
  100.  long lGParam2;
  101.  long lGParam3;
  102.  long lGParam4;
  103.  Boolean fOurPtr;                /*Whether the PrPort allocation was done by us.*/
  104.  Boolean fOurBits;                /*Whether the BitMap allocation was done by us.*/
  105. };
  106.  
  107. typedef struct TPrPort TPrPort;
  108. typedef TPrPort *TPPrPort;
  109.  
  110. /* Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  111.   This is the "PrPeek" record. */
  112. struct TPrInfo {
  113.  short iDev;                    /*Font mgr/QuickDraw device code*/
  114.  short iVRes;                    /*Resolution of device, in device coordinates*/
  115.  short iHRes;                    /*..note: V before H => compatable with Point.*/
  116.  Rect rPage;                    /*The page (printable) rectangle in device coordinates.*/
  117. };
  118.  
  119. typedef struct TPrInfo TPrInfo;
  120. typedef TPrInfo *TPPrInfo;
  121.  
  122. /* Print Info Record: The parameters needed for page composition. */
  123. struct TPrStl {
  124.  short wDev;
  125.  short iPageV;
  126.  short iPageH;
  127.  char bPort;
  128.  TFeed feed;
  129. };
  130.  
  131. typedef struct TPrStl TPrStl;
  132. typedef TPrStl *TPPrStl;
  133.  
  134. struct TPrXInfo {
  135.  short iRowBytes;
  136.  short iBandV;
  137.  short iBandH;
  138.  short iDevBytes;
  139.  short iBands;
  140.  char bPatScale;
  141.  char bUlThick;
  142.  char bUlOffset;
  143.  char bUlShadow;
  144.  TScan scan;
  145.  char bXInfoX;
  146. };
  147.  
  148. typedef struct TPrXInfo TPrXInfo;
  149. typedef TPrXInfo *TPPrXInfo;
  150.  
  151. struct TPrJob {
  152.  short iFstPage;                /*Page Range.*/
  153.  short iLstPage;
  154.  short iCopies;                    /*No. copies.*/
  155.  char bJDocLoop;                /*The Doc style: Draft, Spool, .., and ..*/
  156.  Boolean fFromUsr;                /*Printing from an User's App (not PrApp) flag*/
  157.  PrIdleProcPtr pIdleProc;        /*The Proc called while waiting on IO etc.*/
  158.  StringPtr pFileName;            /*Spool File Name: NIL for default.*/
  159.  short iFileVol;                /*Spool File vol, set to 0 initially*/
  160.  char bFileVers;                /*Spool File version, set to 0 initially*/
  161.  char bJobX;                    /*An eXtra byte.*/
  162. };
  163.  
  164. typedef struct TPrJob TPrJob;
  165. typedef TPrJob *TPPrJob;
  166.  
  167. /* Print Job: Print "form" for a single print request. */
  168. struct TPrint {
  169.  short iPrVersion;                /*(2) Printing software version*/
  170.  TPrInfo prInfo;                /*(14) the PrInfo data associated with the current style.*/
  171.  Rect rPaper;                    /*(8) The paper rectangle [offset from rPage]*/
  172.  TPrStl prStl;                    /*(8)  This print request's style.*/
  173.  TPrInfo prInfoPT;                /*(14)  Print Time Imaging metrics*/
  174.  TPrXInfo prXInfo;                /*(16)  Print-time (expanded) Print info record.*/
  175.  TPrJob prJob;                    /*(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120*/
  176.  short printX[19];                /*Spare to fill to 120 bytes!*/
  177. };
  178.  
  179. typedef struct TPrint TPrint;
  180. typedef TPrint *TPPrint, **THPrint;
  181.  
  182. /* The universal 120 byte printing record */
  183. struct TPrStatus {
  184.  short iTotPages;                /*Total pages in Print File.*/
  185.  short iCurPage;                /*Current page number*/
  186.  short iTotCopies;                /*Total copies requested*/
  187.  short iCurCopy;                /*Current copy number*/
  188.  short iTotBands;                /*Total bands per page.*/
  189.  short iCurBand;                /*Current band number*/
  190.  Boolean fPgDirty;                /*True if current page has been written to.*/
  191.  Boolean fImaging;                /*Set while in band's DrawPic call.*/
  192.  THPrint hPrint;                /*Handle to the active Printer record*/
  193.  TPPrPort pPrPort;                /*Ptr to the active PrPort*/
  194.  PicHandle hPic;                /*Handle to the active Picture*/
  195. };
  196.  
  197. typedef struct TPrStatus TPrStatus;
  198. typedef TPrStatus *TPPrStatus;
  199.  
  200. /* Print Status: Print information during printing. */
  201. struct TPfPgDir {
  202.  short iPages;
  203.  long iPgPos[129];                /*ARRAY [0..iPfMaxPgs] OF LONGINT*/
  204. };
  205.  
  206. typedef struct TPfPgDir TPfPgDir;
  207. typedef TPfPgDir *TPPfPgDir, **THPfPgDir;
  208.  
  209. /* PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) */
  210. struct TPrDlg {
  211.  DialogRecord Dlg;                /*The Dialog window*/
  212.  ModalFilterProcPtr pFltrProc;    /*The Filter Proc.*/
  213.  PItemProcPtr pItemProc;        /*The Item evaluating proc.*/
  214.  THPrint hPrintUsr;                /*The user's print record.*/
  215.  Boolean fDoIt;
  216.  Boolean fDone;
  217.  long lUser1;                    /*Four longs for user's to hang global data.*/
  218.  long lUser2;                    /*...Plus more stuff needed by the particular printing dialog.*/
  219.  long lUser3;
  220.  long lUser4;
  221. };
  222.  
  223. typedef struct TPrDlg TPrDlg;
  224. typedef TPrDlg *TPPrDlg;
  225.  
  226.  
  227. typedef pascal TPPrDlg (*PDlgInitProcPtr)(THPrint hPrint);
  228.  
  229. /* This is the Printing Dialog Record. Only used by folks appending their own dialogs.
  230. Print Dialog: The Dialog Stream object. */
  231.  
  232.  
  233.  
  234. struct TGnlData {
  235.  short iOpCode;
  236.  short iError;
  237.  long lReserved;                /*more fields here depending on call*/
  238. };
  239.  
  240. typedef struct TGnlData TGnlData;
  241.  
  242. struct TRslRg {
  243.  short iMin;
  244.  short iMax;
  245. };
  246.  
  247. typedef struct TRslRg TRslRg;
  248.  
  249. struct TRslRec {
  250.  short iXRsl;
  251.  short iYRsl;
  252. };
  253.  
  254. typedef struct TRslRec TRslRec;
  255.  
  256. struct TGetRslBlk {
  257.  short iOpCode;
  258.  short iError;
  259.  long lReserved;
  260.  short iRgType;
  261.  TRslRg xRslRg;
  262.  TRslRg yRslRg;
  263.  short iRslRecCnt;
  264.  TRslRec rgRslRec[27];
  265. };
  266.  
  267. typedef struct TGetRslBlk TGetRslBlk;
  268.  
  269. struct TSetRslBlk {
  270.  short iOpCode;
  271.  short iError;
  272.  long lReserved;
  273.  THPrint hPrint;
  274.  short iXRsl;
  275.  short iYRsl;
  276. };
  277.  
  278. typedef struct TSetRslBlk TSetRslBlk;
  279.  
  280. struct TDftBitsBlk {
  281.  short iOpCode;
  282.  short iError;
  283.  long lReserved;
  284.  THPrint hPrint;
  285. };
  286.  
  287. typedef struct TDftBitsBlk TDftBitsBlk;
  288.  
  289. struct TGetRotnBlk {
  290.  short iOpCode;
  291.  short iError;
  292.  long lReserved;
  293.  THPrint hPrint;
  294.  Boolean fLandscape;
  295.  char bXtra;
  296. };
  297.  
  298. typedef struct TGetRotnBlk TGetRotnBlk;
  299.  
  300.  
  301. #ifdef __cplusplus
  302. extern "C" {
  303. #endif
  304. pascal void PrPurge(void)
  305.  = {0x2F3C,0xA800,0x0000,0xA8FD}; 
  306. pascal void PrNoPurge(void)
  307.  = {0x2F3C,0xB000,0x0000,0xA8FD}; 
  308. pascal void PrOpen(void)
  309.  = {0x2F3C,0xC800,0x0000,0xA8FD}; 
  310. pascal void PrClose(void)
  311.  = {0x2F3C,0xD000,0x0000,0xA8FD}; 
  312. pascal void PrintDefault(THPrint hPrint)
  313.  = {0x2F3C,0x2004,0x0480,0xA8FD}; 
  314. pascal Boolean PrValidate(THPrint hPrint)
  315.  = {0x2F3C,0x5204,0x0498,0xA8FD}; 
  316. pascal Boolean PrStlDialog(THPrint hPrint)
  317.  = {0x2F3C,0x2A04,0x0484,0xA8FD}; 
  318. pascal Boolean PrJobDialog(THPrint hPrint)
  319.  = {0x2F3C,0x3204,0x0488,0xA8FD}; 
  320. pascal TPPrDlg PrStlInit(THPrint hPrint)
  321.  = {0x2F3C,0x3C04,0x040C,0xA8FD}; 
  322. pascal TPPrDlg PrJobInit(THPrint hPrint)
  323.  = {0x2F3C,0x4404,0x0410,0xA8FD}; 
  324. pascal void PrJobMerge(THPrint hPrintSrc,THPrint hPrintDst)
  325.  = {0x2F3C,0x5804,0x089C,0xA8FD}; 
  326. pascal Boolean PrDlgMain(THPrint hPrint,PDlgInitProcPtr pDlgInit)
  327.  = {0x2F3C,0x4A04,0x0894,0xA8FD}; 
  328. pascal TPPrPort PrOpenDoc(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf)
  329.  = {0x2F3C,0x0400,0x0C00,0xA8FD}; 
  330. pascal void PrCloseDoc(TPPrPort pPrPort)
  331.  = {0x2F3C,0x0800,0x0484,0xA8FD}; 
  332. pascal void PrOpenPage(TPPrPort pPrPort,TPRect pPageFrame)
  333.  = {0x2F3C,0x1000,0x0808,0xA8FD}; 
  334. pascal void PrClosePage(TPPrPort pPrPort)
  335.  = {0x2F3C,0x1800,0x040C,0xA8FD}; 
  336. pascal void PrPicFile(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf,Ptr pDevBuf,
  337.  TPrStatus *prStatus)
  338.  = {0x2F3C,0x6005,0x1480,0xA8FD}; 
  339. pascal short PrError(void)
  340.  = {0x2F3C,0xBA00,0x0000,0xA8FD}; 
  341. pascal void PrSetError(short iErr)
  342.  = {0x2F3C,0xC000,0x0200,0xA8FD}; 
  343. pascal void PrGeneral(Ptr pData)
  344.  = {0x2F3C,0x7007,0x0480,0xA8FD}; 
  345. pascal void PrDrvrOpen(void)
  346.  = {0x2F3C,0x8000,0x0000,0xA8FD}; 
  347. pascal void PrDrvrClose(void)
  348.  = {0x2F3C,0x8800,0x0000,0xA8FD}; 
  349. pascal void PrCtlCall(short iWhichCtl,long lParam1,long lParam2,long lParam3)
  350.  = {0x2F3C,0xA000,0x0E00,0xA8FD}; 
  351. pascal Handle PrDrvrDCE(void)
  352.  = {0x2F3C,0x9400,0x0000,0xA8FD}; 
  353. pascal short PrDrvrVers(void)
  354.  = {0x2F3C,0x9A00,0x0000,0xA8FD}; 
  355. #ifdef __cplusplus
  356. }
  357. #endif
  358.  
  359. #endif
  360.